package com.sunny.ynhz.adapter;

import android.support.annotation.Nullable;
import android.util.Log;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sunny.ynhz.R;
import com.sunny.ynhz.bean.StandardBean;
import com.sunny.ynhz.bean.WxyyBean;
import com.sunny.ynhz.utils.TimeUtils;

import java.util.List;

/**
 * Created by huhuan123 on 2018/8/9.
 *
 * @describe TODO
 */

public class WxyyDBAdapter extends BaseQuickAdapter<WxyyBean.RateListBean, BaseViewHolder> {
    public WxyyDBAdapter(@Nullable List<WxyyBean.RateListBean> data) {
        super(R.layout.ietm_wxyy_lv, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, WxyyBean.RateListBean item) {
        helper.setText(R.id.tv_time, TimeUtils.stampToTime(item.getTIME()) + "");
        helper.setText(R.id.tv_name, item.getNAME());
        helper.setText(R.id.tv_number, item.getPROBLEMID());
        helper.setText(R.id.tv_address, item.getPOSITION());
        if (helper.getPosition() % 2 == 0) {
            helper.setBackgroundRes(R.id.tv_duty, R.drawable.ic_wxyy_cicle);
        } else {
            helper.setBackgroundRes(R.id.tv_duty, R.drawable.ic_wxyy_cicle1);
        }
        if (item.getSTATE().equals("4")) {//已办结
            helper.setText(R.id.tv_status, "已办结");
        } else if (item.getSTATE().equals("3")) {//待复核
            helper.setText(R.id.tv_status, "待复核");
        } else {
            helper.setText(R.id.tv_status, "处理中");
        }
        String river_type = item.getRIVER_TYPE();
        String rnText = null;
        int mriver_type = Integer.parseInt(river_type);
        if (mriver_type <= 6) {
            rnText = "州";
        } else if (mriver_type <= 11) {
            rnText = "县市";
        } else if (mriver_type <= 15) {
            rnText = "镇";
        } else if (mriver_type == 16) {
            rnText = "村";
        }
        helper.setText(R.id.tv_duty, rnText);
        helper.setBackgroundRes(R.id.tv_status, R.drawable.bg_wxyy_statue);

    }
}
